<script type="text/html" template
        lay-url="{{ window.globalConfig.url_ad_list + '/' + layui.router().search.id }}"
        lay-done="layui.data.done(d);">
    <title>片段详情</title>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <a lay-href="home/adPosition/ad/list/position_id={{ layui.router().search.position_id }}"
                           class="layui-btn layui-btn-primary layui-btn-sm">返回上级</a>
                        {{ d.data.ad_name }}
                    </div>
                    <div class="layui-card-body">
                        <div class="layui-form" lay-filter="LAY-home-ad-listform" id="LAY-home-ad-listform"
                             style="padding: 20px 30px 0 0;">
                            <div class="layui-form-item">
                                <label class="layui-form-label">名称</label>
                                <div class="layui-input-inline" style="width: 50%">
                                    <input type="text" name="ad_name" value="{{ d.data.ad_name || '' }}"
                                           lay-verify="required"
                                           placeholder="请输入名称" autocomplete="off" class="layui-input"
                                           {{# if(layui.router().search.mode=='read' ){ }}
                                           readonly
                                           {{# } }}
                                    >
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <label class="layui-form-label">媒体类型</label>
                                <div class="layui-input-block">
                                    {{# if(d.data.media_type == 1){ }}
                                    <input type="radio" name="media_type" value="1" title="图片" checked>
                                    <input type="radio" name="media_type" value="2" title="视频">
                                    {{# } else { }}
                                    <input type="radio" name="media_type" value="1" title="图片">
                                    <input type="radio" name="media_type" value="2" title="视频" checked>
                                    {{# } }}

                                </div>
                            </div>


                            <div class="layui-form-item">
                                <label class="layui-form-label">视频链接</label>
                                <div class="layui-input-inline" style="width: 50%">
                                    <input type="text" name="ad_link" value="{{ d.data.ad_link || '' }}"
                                           placeholder="请输入链接地址" autocomplete="off"
                                           class="layui-input"
                                           {{# if(layui.router().search.mode=='read' ){ }}
                                           readonly
                                           {{# } }}
                                    >
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">图片地址</label>
                                    <div class="layui-input-block">
                                        <div class="layui-upload-list" id="ID-upload-ad_code-btn">
                                            <img
                                                    {{# if(d.data.ad_code){ }}
                                                    src="{{ window.globalConfig.img_bind_url + d.data.ad_code}}"
                                                    {{# } else { }}
                                                    src="./res/style/imgs/upload.png"
                                                    {{# } }}

                                                    id="ID-upload-ad_code-img" style="max-width: 500px"
                                                    class="layui-upload-img">
                                        </div>
                                        <input type="text" name="ad_code" id="ad_code" class="layui-input" value="{{ d.data.ad_code }}">
                                    </div>
                                <div class="layui-form-mid layui-word-aux size-suggest"></div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">手机图片</label>
                                <div class="layui-input-block">
                                    <div class="layui-upload-list" id="ID-upload-mad_code-btn">
                                        <img
                                                {{# if(d.data.mad_code){ }}
                                                src="{{ window.globalConfig.img_bind_url + d.data.mad_code}}"
                                                {{# } else { }}
                                                src="./res/style/imgs/upload.png"
                                                {{# } }}

                                                id="ID-upload-mad_code-img" style="max-width: 500px"
                                                class="layui-upload-img">
                                    </div>
                                    <input type="text" name="mad_code" id="mad_code" class="layui-input" value="{{ d.data.mad_code }}">

                                </div>
                                <div class="layui-form-mid layui-word-aux size-suggest"></div>
                            </div>

                            <!--                            <div class="layui-form-item">-->
                            <!--                                <div class="layui-inline">-->
                            <!--                                    <label class="layui-form-label">生效日期</label>-->

                            <!--                                    <div class="layui-inline" id="ID-laydate-rangeLinked">-->
                            <!--                                        <div class="layui-input-inline">-->
                            <!--                                            <input type="text" autocomplete="off" id="test-laydate-start"-->
                            <!--                                                   name="start_time"-->
                            <!--                                                   class="layui-input" placeholder="开始日期"-->
                            <!--                                                   value="{{ d.data.start_time }}">-->
                            <!--                                        </div>-->
                            <!--                                        <div class="layui-form-mid">-</div>-->
                            <!--                                        <div class="layui-input-inline">-->
                            <!--                                            <input type="text" autocomplete="off" id="test-laydate-end"-->
                            <!--                                                   name="end_time"-->
                            <!--                                                   class="layui-input" placeholder="结束日期"-->
                            <!--                                                   value="{{ d.data.end_time }}">-->
                            <!--                                        </div>-->
                            <!--                                    </div>-->

                            <!--                                </div>-->
                            <!--                            </div>-->
                            <div class="layui-form-item">
                                <label class="layui-form-label">是否开启</label>
                                <div class="layui-input-inline">
                                    <input type="checkbox" name="enabled" title="开启|关闭" value="1" lay-skin="switch"
                                           {{# if(d.data.enabled){ }}
                                           checked
                                           {{# } }}
                                    >
                                </div>
                            </div>

                            <!--  广告的文字内容  -->
                            <div class="layui-form-item">
                                <label class="layui-form-label">广告描述</label>
                                <div class="layui-input-inline" style="width: 100%">
                                    <div id="editor"></div>
                                </div>
                            </div>

                            <input type="hidden" name="ad_id" value="{{ d.data.ad_id }}">
                            <input type="hidden" name="position_id" value="{{ layui.router().search.position_id }}">

                            {{# if(layui.router().search.mode!='read' ){ }}
                            <div class="layui-form-item">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input type="button" lay-submit lay-filter="LAY-home-ad-listform-submit"
                                           value="保存" class="layui-btn">
                                </div>
                            </div>
                            {{# } }}


                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>
<script src="res/modules/ad.js"></script>
